﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "rc4.h"

// 全局配置的获取和设置
inline QString getInfor(QString key){
    QSettings cfg(QSettings::IniFormat, QSettings::UserScope, APP_CONFIG);
    QString value=cfg.value(key, "").toString();
    return QString::fromStdString(RC4(value.toStdString(), "xinfeng2", false));
}
inline void setInfor(QString key, QString data){
    QSettings cfg(QSettings::IniFormat,QSettings::UserScope, APP_CONFIG);
    cfg.setValue(key, QString::fromStdString(RC4(data.toStdString(), "xinfeng2", true)));
}

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class FormKeyData;
class FormPrinter;
class FormPrinterPack;
class MainWindow : public QMainWindow
{
    Q_OBJECT
private:
    QVector<QVector<QString>> v_xls_data;
    QPixmap pixmap_ok, pixmap_error;

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void ActionPrint();
    static void log(QString str);
    static void static_text(QString str);

private slots:
    void on_actionreset_bartender_triggered();
    void on_actionreset_bartend2_triggered();
    void switch_tab_on(QString dataFilePath);
    void on_tabWidget_currentChanged(int index);
    void on_actionsearch_all_triggered();
    void on_actionexport_data_text_triggered(bool checked);
    void on_actionexport_data_xls_triggered(bool checked);
    void slot_reset_export_data_method(int ed_method);
    void slot_reset_print_method(int ed_method);

    void on_actionmethod_bartender_triggered(bool checked);

    void on_actionmethod_bylabel_triggered(bool checked);

    void on_actionreset_bylabel_triggered();

    void on_actionreset_bylabel2_triggered();

    void on_actionforce_stop_process_triggered();

private:
    Ui::MainWindow *ui;
    FormKeyData *formKeyData;
    FormPrinter *formPrinter;
    FormPrinterPack *formPrinterPack;
};
#endif // MAINWINDOW_H
